import Vue from 'vue'
import store from './store'
import App from './App'
// import i18n from './I18n/index.js'
import { CommonMixin } from './common/mixin/common-mixin'
import { BackGroundMixin } from './common/mixin/background-mixin'
import { TrackEventMixin } from '@/common/mixin/trackEvent-mixin'
import { PopMixin } from './components/pops/mixin'
// #ifdef H5
import { initH5 } from '@/common/logic/h5-common'
require('./common/stage-check')
// #endif

initApp()

async function initApp () {
  // 公用mixins
  initMixin()

  // #ifdef H5
  // 初始化H5相关逻辑，包括logo、版权、反馈、聚合登录等
  await initH5()
  // #endif

  initVue()
}

function initMixin () {
  Vue.mixin(CommonMixin)
  Vue.mixin(BackGroundMixin)
  Vue.mixin(TrackEventMixin)
  Vue.mixin(PopMixin)
}

function initVue () {
  Vue.config.productionTip = false
  App.mpType = 'app'
  const config = {
    store,
    ...App
  }
  // 启用i18n多语言配置
  // if (i18n) {
  //   config.i18n = i18n
  // }
  const app = new Vue(config)
  app.$mount()
}
